using System;
using System.Collections.Generic;
using System.Text;

namespace JobShopModel.Model.FactoryLvl
{
    /// <summary>
    /// Class used to track usage statistics for different objects in the factory
    /// </summary>
    public class Statistics
    {
        //overall progress of the simulation
        private Decimal simProgress;
        //current state (INITIALIZED, RUNNING, etc)
        private SimulationStates simState;

        //time in queue for each type of job
        private Time[] jobQueueDelay = new Time[3];
        //time in transit for each type of job
        private Time[] jobTransDelay = new Time[3];
        //time waiting for transporter for each type of job
        private Time[] jobFifoDelay = new Time[3];
        //number of jobs completed of each type
        private int[] jobCounter = new int[3];
        //number of jobs created of each type
        private int[] jobCreatedCounter = new int[3];

        public int[] JobCreatedCounter
        {
            get { return jobCreatedCounter; }
        }

        //time working for machines at each station
        private Decimal[] machWorking = new Decimal[5];
        //time blocked by finished operations for machines at each station
        private Decimal[] machBlocked = new Decimal[5];
        //time spent idle by machines at each station
        private Decimal[] machIdle = new Decimal[5];
        //total time spent in queue by jobs waiting at each station while machines are working
        private Time[] machQueueDelay = new Time[5];
        //number of machines in the queue while all machines are working
        private int[] machNumQueue = new int[5];
        //number of operations completed at each station
        private int[] numOperation = new int[5];

        public int[] NumOperation
        {
            get { return numOperation; }
        }

        //percentage of time the transporter is being utilized
        private Decimal transUtil;
        //average time between stations
        private Time transTime;
        //number of jobs transported
        private int numTransp;

        public int NumTransp
        {
            get { return numTransp; }
            set { numTransp = value; }
        }


        public Statistics()
        {
        }

        public Decimal SimProgress
        {
            get { return this.simProgress; }
            set { this.simProgress = value; }
        }

        public SimulationStates SimState
        {
            get{ return this.simState; }
            set { this.simState = value; }
        }

        // Job Type - Delay In Queue


        public Time getJobQueueDelay(int indexJob)
        {
            return jobQueueDelay[indexJob];
        }

        public void setJobQueueDelay(int index, Time value)
        {
            this.jobQueueDelay[index] = value;
        }


        // Job Type - Transporter Delay


        public Time getJobTransDelay(int indexJob)
        {
            return jobTransDelay[indexJob];
        }

        public void setJobTransDelay(int index, Time value)
        {
            this.jobTransDelay[index] = value;
        }

        //transport type FIFO DELAY

        public Time getJobFifoDelay(int indexJob)
        {
            return jobFifoDelay[indexJob];
        }

        public void setJobFifoDelay(int index, Time value)
        {
            this.jobFifoDelay[index] = value;
        }

        // Machine Group - Average Working Time



        public Decimal getMachWorking(int indexJob)
        {
            return machWorking[indexJob];
        }

        public void setMachWorking(int index, Decimal value)
        {
            this.machWorking[index] = value;
        }


        // Machine Group - Average Blocked Time




        public Decimal getMachBlocked(int indexJob)
        {
            return machBlocked[indexJob];
        }

        public void setMachBlocked(int index, Decimal value)
        {
            this.machBlocked[index] = value;
        }


        // Machine Group - Average Idle Time



        public Decimal getMachIdle(int indexJob)
        {
            return machIdle[indexJob];
        }

        public void setMachIdle(int index, Decimal value)
        {
            this.machIdle[index] = value;
        }


        // Machine Group - Average Number Jobs In Queue


        public int getMachNumQueue(int indexJob)
        {
            return machNumQueue[indexJob];
        }

        public void setMachNumQueue(int index, int value)
        {
            this.machNumQueue[index] = value;
        }


        // Machine Group - Mean Delay In Queue


        public Time getMachQueueDelay(int indexJob)
        {
            return machQueueDelay[indexJob];
        }

        public void setMachQueueDelay(int index, Time value)
        {
            this.machQueueDelay[index] = value;
        }

        // Transporter - Utilization


        public Decimal TranspUtil
        {
            get { return this.transUtil; }
            set { this.transUtil = value; }
        }

        // Transporter - Average Transport Time


        public Time TranspTime
        {
            get { return this.transTime; }
            set { this.transTime = value; }
        }
    }
}
